home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 257 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: bga.com!news
  2. From: makuch@bga.com (Michael Makuch)
  3. Newsgroups: comp.lang.c,comp.os.ms-windows.nt.misc,comp.programming,comp.std.c,comp.unix.aix
  4. Subject: Re: function pointers
  5. Date: 31 Jan 1996 19:56:11 GMT
  6. Organization: Real/Time Communications - Bob Gustwick and Associates
  7. Message-ID: <4eohgr$gt0@giga.bga.com>
  8. References: <4eogio$gt0@giga.bga.com>
  9. Mime-Version: 1.0
  10. X-RTcode: 2e38723c315b7bb02e0fc90e
  11. X-Newsreader: WinVN 0.99.4
  12.  
  13. In article <4eogio$gt0@giga.bga.com>, makuch@bga.com says...
  14. >
  15. >The following c code segment compiles and works on
  16. >NT MSVC++ and on SVR4 C compiler, but errors out
  17. >on AIX with a type mismatch;
  18. >
  19. >struct foostruct1 * myfoo1();
  20. >struct foostruct2 * myfoo2();
  21. >void *(*ptr)();
  22. >
  23. >ptr = myfoo1;
  24. >[snip]
  25. >ptr = myfoo2;
  26. >
  27. >I'm passing the function pointer ptr, to a function
  28. >which then calls myfoo1, myfoo2, etc., etc. I can think
  29. >of several work arounds but I'd rather get the AIX
  30. >compiler to accept it. Is there a portable solution to
  31. >get the AIX compiler to accept it? Casting the assignment
  32. >as
  33. >
  34. >prt = (struct foostruct1 *)myfoo1;
  35. >
  36. >doesn't work either.
  37. >
  38. >Thanx for any clues.
  39. >mkm@abm.austin.tx.us
  40. >
  41.  
  42. Oops. What I meant to say at the end there was that
  43.  
  44. prt = (void *)myfoo1();
  45.  
  46. doesn't work either.
  47.  
  48. Thanx.
  49. mkm@abm.austin.tx.us
  50.  
  51.